<template>
  <div class="operation-logs-page">
    <el-dialog title="操作日志" :visible.sync="visible" :close-on-click-modal="false" :close-on-press-escape="false" @close="closeLogs">
      <table-box ref="tableRef" :table-config="tableConfig" :table-height="420" />
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'OperationLogs',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    url: {
      type: String,
      default: '',
      required: true
    }
  },
  data() {
    return {
      visible: this.show,
      tableConfig: {
        interfacePath: this.url,
        tabIndex: 100,
        buttonGroupCode: 'OperationLogs',
        onlySearchBar: true,
        setting: [{
          prop: 'operUserName',
          label: '操作人姓名'
        },
        {
          prop: 'operAccount',
          label: '操作人账号'
        },
        {
          prop: 'action',
          label: '操作动作'
        },
        {
          prop: 'content',
          label: '操作内容'
        },
        {
          prop: 'createTime',
          label: '操作时间',
        }]
      }
    }
  },
  watch: {
    show: {
      handler: function(val) {
        this.visible = Boolean(val)
      }
    }
  },
  methods: {
    closeLogs() {
      this.$nextTick(() => {
        this.$emit('update:show', false)
      })
    }
  }
}
</script>

<style scoped>
</style>
